package com.zoe.onelink.actuate.check;

import com.zoe.onelink.plugin.check.AbstractEnvironmentChecker;
import com.zoe.onelink.plugin.check.model.PropertyCheckResult;
import org.springframework.util.ClassUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>标题: </p>
 * <p>描述: </p>
 * <p>版权: Copyright (c) 2022</p>
 * <p>公司: 智业软件股份有限公司</p>
 *
 * @version: 1.0
 * @author: ruansheng
 * @date: 2022-11-28
 */
public class DubboModuleChecker extends AbstractEnvironmentChecker {

    @Override
    protected List<PropertyCheckResult<?>> doCheck() {
        boolean dubboModuleIsPresent = ClassUtils.isPresent("org.apache.dubbo.config.spring.context.annotation.EnableDubbo", null);
        List<PropertyCheckResult<?>> results = new ArrayList<>();
        if (dubboModuleIsPresent) {
            PropertyCheckResult<Boolean> checkResult = new PropertyCheckResult<Boolean>()
                    .setPropKey("-")
                    .setPropValue(true)
                    .setLevel(PropertyCheckResult.Level.DANGER)
                    .setMessage("请及时移除DUBBO相关依赖");
            results.add(checkResult);
        }
        return results;
    }

}
